You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We added the isOneShot() check to ensure that rewindable request body streams are reset after writing them e.g. after request body is written to a logging interceptor. Previously, a logging interceptor would drain the request body stream causing the network call to have an empty body.
However, we didn't handle the failure scenarios of reset() according to the docs
This PR makes a best effort measure to prevent draining the request body by an interceptor before the final network request.
If a positive content length is available, we mark() the start of the stream with the entire stream's content length as the read limit.
If during the sink.writeAll() a new mark() is set causing the reset() to fail, we log the exception but don't fail the entire request.
We do not fail the entire request in case the first call to reset() happens during the network call.
Hi @Ndiritu Did you see my last message.In retry method there is also reset that throw an exception.(retryCAEResponseIfRequired) Thanks, Itay
@ihudedi the reset() called at this point is necessary since before retrying a request after getting a claims challenge we need to attempt to reset the body.
In this case, the error handling works as expected by bubbling up the exception to a developer's application.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We added the
isOneShot()check to ensure that rewindable request body streams are reset after writing them e.g. after request body is written to a logging interceptor. Previously, a logging interceptor would drain the request body stream causing the network call to have an empty body.However, we didn't handle the failure scenarios of
reset()according to the docsThis PR makes a best effort measure to prevent draining the request body by an interceptor before the final network request.
If a positive content length is available, we
mark()the start of the stream with the entire stream's content length as the read limit.If during the
sink.writeAll()a newmark()is set causing thereset()to fail, we log the exception but don't fail the entire request.We do not fail the entire request in case the first call to
reset()happens during the network call.closes microsoftgraph/msgraph-sdk-java#2245
Existing unit tests for the various stream scenarios still pass